<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%
		String stuId = request.getParameter("stuId");
		String classId = request.getParameter("classId");
		String stuName = request.getParameter("stuName");
		String stuAge = request.getParameter("stuAge");
		String stuSex = request.getParameter("stuSex");
       try{
       	   Class.forName("com.mysql.jdbc.Driver").newInstance();
       	   Connection con = java.sql.DriverManager.getConnection("jdbc:mysql://localhost:3306/classfee", "root", "wongxc0513");
       	   Statement stmt = con.createStatement();
	       	ResultSet rs=stmt.executeQuery("select * from tb_student");
			int t=0;
			while(rs.next())
			{
				if(stuId.equals(rs.getString("stuId")))
				{
					t++;
				}
			}
			if(t==0)
			{
				out.println("<script>alert('没有此条信息!');window.location('studentselect.html')</script>");
			}
			else
			{
    	      ResultSet rs1=stmt.executeQuery("select * from tb_student where stuId='"+stuId+"'");
    	      while(rs1.next())
    	      {
  %>
    <table align="center" border="1" rules=rows rules=cols>
		<tr align="center">
			<td width="80"><font face="微软雅黑">班级成员编号</font></td>
	        <td width="80"><font face="微软雅黑">班级编号</font></td>
		    <td width="80"><font face="微软雅黑">姓名</font></td>
		    <td width="80"><font face="微软雅黑">年龄</font></td>
		    <td width="80"><font face="微软雅黑">性别</font></td>
		</tr>
		<tr align="center">
		<td width="80"><font face="微软雅黑"><%out.println(rs1.getString("stuId"));%></font></td>
		<td width="80"><font face="微软雅黑"><%out.println(rs1.getString("classId"));%></font></td>
		<td width="80"><font face="微软雅黑"><%out.println(rs1.getString("stuName"));%></font></td>
		<td width="80"><font face="微软雅黑"><%out.println(rs1.getString("stuAge"));%></font></td>
		<td width="80"><font face="微软雅黑"><%out.println(rs1.getString("stuSex"));%></font></td>
		</tr>
		</table>
 <%   
    	      }
			}
    	       stmt.close();
    	       con.close();
         }
      catch(Exception ex)
      { 
    	   out.println("<script>alert('查询失败!')</script>");
    	   out.println(ex.getMessage());
      }
	       
%>